<?php
/**
 * AccountProfile.php
 * @author Winbeek <winbeek@gmail.com>
 * @since 21 July 2012
 * @version $Id: AccountProfile.php 24 2012-07-28 14:50:51Z winbeek $
 */

class AccountProfile extends Nette\Application\UI\Control
{
	/**
	 * @var Nette\Database\Table\ActiveRow $account
	 */
	private $account;

	/**
	 * @var Texy $texy
	 */
	private $texy;

	/**
	 * @param Texy $texy
	 * @param Nette\Database\Table\ActiveRow $account
	 */
	public function __construct(Texy $texy, Nette\Database\Table\ActiveRow $account)
	{
		$this->account = $account;
		$this->texy = $texy;
	}

	public function render()
	{
		$founder = ($this->account->profile == NULL)?'NotFound':'';
		$this->template->setFile(__DIR__ . '/AccountProfile'.$founder.'.latte');

		$this->template->account = clone $this->account;
		$this->template->account->profile = $this->texy->process($this->template->account->profile);

		$this->template->render();
	}
}
